#!/bin/bsh

DMDIR="/usr/lpp/r390/bin"

echo "* Attempting to start two HCON 3270 sessions and one 3215 session."
sleep 1 

# ******************************************************************************
# Sample 3270 emulators (tn3270 and x3270) 
# ******************************************************************************
# $DMDIR/AWSWait aixterm -T "3270 Console 1 (`hostname`)" -g +1+430 -e tn3270 localhost 3046 &
# $DMDIR/AWSWait aixterm -T "3270 Console 2 (`hostname`)" -g +40+380 -e tn3270 localhost 3046 &
# rm -rf nohup.msgs
# nohup $DMDIR/AWSWait x3270 -ext -sk -graphics -port 3046 localhost -geom +1+430 >nohup.msgs
# nohup $DMDIR/AWSWait x3270 -ext -sk -graphics -port 3046 localhost -geom +40+380 >nohup.msgs

# ******************************************************************************
# Start HCON if installed, else use XANT 
# ******************************************************************************
if [ -d "/usr/lpp/hcon" ] ; then 
	nohup $DMDIR/AWSWait xhcon c >nohup.msgs &
	sleep 1
	nohup $DMDIR/AWSWait xhcon d >nohup.msgs &
else
	echo "* HCON Not installed.  Trying X3270."
	if [ -d "/usr/lpp/x3270" ] ; then 
		nohup $DMDIR/AWSWait x3270 -title "X3270 Console 3 (`hostname`)" -ext -sk -graphics -port 3046 localhost -geom +1+430 >nohup.msgs 
		sleep 1
		nohup $DMDIR/AWSWait x3270 -title "X3270 Console 4 (`hostname`)" -ext -sk -graphics -port 3046 localhost -geom +40+380 >nohup.msgs
	else
		echo "* X3270 Not installed.  Using XANT."
		nohup $DMDIR/AWSWait xant -title "XANT 3270 Console 3 (`hostname`)" -ext -sk -graphics -port 3046 localhost -geom +1+430 >nohup.msgs 
		sleep 1
		nohup $DMDIR/AWSWait xant -title "XANT 3270 Console 4 (`hostname`)" -ext -sk -graphics -port 3046 localhost -geom +40+380 >nohup.msgs
	fi
fi

echo "******************************************************************************"
